package com.itheima.file;

import java.io.File;
import java.io.IOException;

/*
判断文件对象是否存在
 */
public class Demo02 {

    public static void main(String[] args) throws IOException {
        File file1 = new File("day12\\abc.txt");
        File file2 = new File("abc");//相对路径
        File file3 = new File("day12\\bbb.txt");
        System.out.println(file1.exists());
        System.out.println(file2.exists());
        System.out.println(file3.exists());
        //创建文件
        System.out.println(file1.createNewFile());
        //创建文件夹
        System.out.println(file2.mkdir());
        //多级目录
        File file = new File("D:\\zhaichaojie\\abc\\abc");
        System.out.println(file.exists());
        if(!file.exists()){
            System.out.println(  file.mkdir());;
            System.out.println(  file.mkdirs());;
        }


    }
}
